package com.googlecode.dgwt.client.dijit.event;

import com.google.gwt.user.client.Event;
import com.googlecode.dgwt.client.dijit.view.store.RowView;

/**
 * @author wellsantos@wellsantos.com
 * @since 0.01
 */
public class RowDoubleClickEvent extends RowEvent<RowDoubleClickHandler> {

    private static Type<RowDoubleClickHandler> TYPE;
    
    protected RowDoubleClickEvent(Event nativeEvent, int rowIndex, Object rowItem) {
        super(nativeEvent, rowIndex, rowItem);
    }
    
    @Override
    public Event getNativeEvent() {
        return super.getNativeEvent();
    }

    public static void fire(RowView source, Event nativeEvent, int rowIndex, Object rowItem){
        if (TYPE != null){
            source.fireEvent(new RowDoubleClickEvent(nativeEvent, rowIndex, rowItem));
        }
    }

    public static Type<RowDoubleClickHandler> getType() {
        if (TYPE == null){
            TYPE = new Type<RowDoubleClickHandler>();
        }
        return TYPE;
    }

    @Override
    protected void dispatch(RowDoubleClickHandler handler) {
        handler.onRowDoubleClick(this);
    }

    @Override
    public Type<RowDoubleClickHandler> getAssociatedType() {
        return TYPE;
    }

}
